﻿using System;
using System.Windows.Data;

namespace Dsl.Ped.Common.Converters 
{
    /// <summary>
    /// Abstract converter that converts an object into a <see cref="string"/> via an abstract <see cref="Localize"/> method.
    /// It is indended for the conversion of an object into a localized <see cref="string"/>
    /// </summary>
    public abstract class AbstractObjectToLocalizedStringConverter : IValueConverter 
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return Localize(value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Localize object to a <see cref="string"/> against the current culture
        /// </summary>
        /// <param name="type">Object to be localized</param>
        /// <returns>Localized <see cref="string"/></returns>
        public abstract string Localize(object obj);

        #endregion IValueConverter
    }
}
